#ifndef PLAYER_H
#define PLAYER_H

#include "fmod.h"
#include <QtCore/QString>
#include <QtCore/QThread>

class Player : public QThread
{
	Q_OBJECT

public:
	Player();
	~Player();

	void play(QString);
	void pause(void);
	void stop(void);

	void setPosition(unsigned int);
	void setVolume(float);
	void setFrequency(int);

protected:
	void run(void);

signals:
	void readyToPlay(unsigned int, QString);
	void playing(unsigned int);
	void paused(void);
	void stopped(void);
	void finished(void);

private:
	FMOD_SYSTEM     *system;
    FMOD_SOUND      *sound;
    FMOD_CHANNEL    *channel;

	int isPaused;
	int isPlaying;

	float frequency;
	float volume;
	float f_rate;
	bool flagstop;
    unsigned int len;
	unsigned int pos;
	QString filepath;
	//volatile bool paused;
	//volatile available state;
};

#endif
